package com.google.gson.internal;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.logging.Logger;

public final class i {
    private static final Logger a = Logger.getLogger(i.class.getName());
    private final Map b = new HashMap();
    private final Map c = new HashMap();
    private final List d = new ArrayList();
    private final List e = new ArrayList();
    private boolean f = true;

    private Object a(Class cls, boolean z) {
        if (!z) {
            for (h hVar : this.e) {
                if (((Class) hVar.a).isAssignableFrom(cls)) {
                    return hVar.b;
                }
            }
        }
        for (h hVar2 : this.d) {
            if (((Class) hVar2.a).isAssignableFrom(cls)) {
                return hVar2.b;
            }
        }
        return null;
    }

    private String a(Type type) {
        return b.e(type).getSimpleName();
    }

    private void a(StringBuilder stringBuilder, List list) {
        Object obj = 1;
        for (h hVar : list) {
            Object obj2;
            if (obj != null) {
                obj2 = null;
            } else {
                stringBuilder.append(',');
                obj2 = obj;
            }
            stringBuilder.append(a((Type) hVar.a)).append(':');
            stringBuilder.append(hVar.b);
            obj = obj2;
        }
    }

    private void a(StringBuilder stringBuilder, Map map) {
        Object obj = 1;
        for (Entry entry : map.entrySet()) {
            Object obj2;
            if (obj != null) {
                obj2 = null;
            } else {
                stringBuilder.append(',');
                obj2 = obj;
            }
            stringBuilder.append(a((Type) entry.getKey())).append(':');
            stringBuilder.append(entry.getValue());
            obj = obj2;
        }
    }

    public synchronized i a() {
        this.f = false;
        return this;
    }

    /* JADX WARNING: inconsistent code. */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public synchronized java.lang.Object a(java.lang.reflect.Type r3, boolean r4) {
        /*
        r2 = this;
        monitor-enter(r2);
        if (r4 != 0) goto L_0x000d;
    L_0x0003:
        r0 = r2.c;	 Catch:{ all -> 0x0026 }
        r0 = r0.get(r3);	 Catch:{ all -> 0x0026 }
        if (r0 == 0) goto L_0x000d;
    L_0x000b:
        monitor-exit(r2);
        return r0;
    L_0x000d:
        r0 = r2.b;	 Catch:{ all -> 0x0026 }
        r0 = r0.get(r3);	 Catch:{ all -> 0x0026 }
        if (r0 != 0) goto L_0x000b;
    L_0x0015:
        r1 = com.google.gson.internal.b.e(r3);	 Catch:{ all -> 0x0026 }
        if (r1 == r3) goto L_0x0021;
    L_0x001b:
        r0 = r2.a(r1, r4);	 Catch:{ all -> 0x0026 }
        if (r0 != 0) goto L_0x000b;
    L_0x0021:
        r0 = r2.a(r1, r4);	 Catch:{ all -> 0x0026 }
        goto L_0x000b;
    L_0x0026:
        r0 = move-exception;
        monitor-exit(r2);
        throw r0;
        */
        throw new UnsupportedOperationException("Method not decompiled: com.google.gson.internal.i.a(java.lang.reflect.Type, boolean):java.lang.Object");
    }

    public String toString() {
        StringBuilder stringBuilder = new StringBuilder("{userTypeHierarchyList:{");
        a(stringBuilder, this.e);
        stringBuilder.append("},systemTypeHierarchyList:{");
        a(stringBuilder, this.d);
        stringBuilder.append("},userMap:{");
        a(stringBuilder, this.c);
        stringBuilder.append("},systemMap:{");
        a(stringBuilder, this.b);
        stringBuilder.append("}");
        return stringBuilder.toString();
    }
}
